var page_super = require("page_obj");

function page_hello() {
    this.setPageName("ui_hello");
    this.setPageUrl("/ui/hello");
    this.page_handler = function(req, res){
        res.writeHead(200, {"Content-Type": "text/html"});
        this.htmlbody = getHtmlBody(req, res);
        res.write(this.htmlbody);
    };

    function getHtmlBody(req, res) {
        var body = '';
        body += '								\
<html>										\
<head>										\
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />		\
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>		\
<title> Hello page </title>							\
<script type="text/javascript">							\
$(function(){									\
    $("#btn_hello").click(function(e){						\
        var data = {};								\
        $.ajax({								\
            type: "POST",							\
            data: JSON.stringify(data),						\
            contentType: "application/json",					\
            url: "/ws/hello",							\
            success: function(data) {						\
                alert(data);							\
            }									\
        });									\
    });										\
});										\
</script>									\
</head>										\
<body>										\
<h1> This is sample page </h1>							\
<form action="/ws/hello" method="post">						\
<input type="button" id="btn_hello" value="press me">				\
</form>										\
</html>										\
    ';
        return body;
    }
}

page_hello.prototype = new page_super.page_obj();

var _page_hello = new page_hello();
_page_hello.addPage(_page_hello);
